package com.qianfeng.yime.model;

/**
 * Created by Fcy on 2015/3/12.
 */

import com.qianfeng.yime.Constants;
import org.json.JSONException;
import org.json.JSONObject;

public class Job {
    private int cityId; // 城市id
    private int corpId; // 商家id
    private String corpLogo; // 商家logo 需要拼接
    private String corpName; // 商家名称
    private int corpRank;
    private int count; // 需求人数
    private long creatTime;
    private int distance; // 距离
    private int id; // 职位id
    private int jobsettletypeId; // 日结 ：结算类型，需要用图片对应显示
    private int jobtimetypeId;
    private int jobtypeId; // //3 促销员：工作类型
    private double lat;
    private double lon;
    private String name; // 招聘语
    private int pay; // 薪水
    private int payUnit; // 元/件
    private int regiNum;

    public void parseJson(JSONObject json) {
        try {
            cityId = json.getInt("cityId");
            corpId = json.getInt("corpId");
            corpLogo = Constants.API_POINT_URL + json.getString("corpLogo");
            corpName = json.getString("corpName");
            corpRank = json.getInt("corpRank");
            count = json.getInt("count");
            creatTime = json.getLong("creatTime");
            distance = json.getInt("distance");
            id = json.getInt("id");
            jobsettletypeId = json.getInt("jobsettletypeId");
            jobtimetypeId = json.getInt("jobtimetypeId");
            jobtypeId = json.getInt("jobtypeId");
            lat = json.getDouble("lat");
            lon = json.getDouble("lon");
            name = json.getString("name");
            pay = json.getInt("pay");
            payUnit = json.getInt("payUnit");
            regiNum = json.getInt("regiNum");
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    /**
     * 重写HotJob的equals方法，根据id是否相等，判断是否是同一对象
     *
     * @param o
     * @return
     */
    @Override
    public boolean equals(Object o) {
        Job job = (Job) o;
        if (job.id == this.id) { // 同一个
            return true;
        }
        return false;
    }

    public int getCityId() {
        return cityId;
    }

    public void setCityId(int cityId) {
        this.cityId = cityId;
    }

    public int getCorpId() {
        return corpId;
    }

    public void setCorpId(int corpId) {
        this.corpId = corpId;
    }

    public String getCorpLogo() {
        return corpLogo;
    }

    public void setCorpLogo(String corpLogo) {
        this.corpLogo = corpLogo;
    }

    public String getCorpName() {
        return corpName;
    }

    public void setCorpName(String corpName) {
        this.corpName = corpName;
    }

    public int getCorpRank() {
        return corpRank;
    }

    public void setCorpRank(int corpRank) {
        this.corpRank = corpRank;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public long getCreatTime() {
        return creatTime;
    }

    public void setCreatTime(long creatTime) {
        this.creatTime = creatTime;
    }

    public int getDistance() {
        return distance;
    }

    public void setDistance(int distance) {
        this.distance = distance;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getJobsettletypeId() {
        return jobsettletypeId;
    }

    public void setJobsettletypeId(int jobsettletypeId) {
        this.jobsettletypeId = jobsettletypeId;
    }

    public int getJobtimetypeId() {
        return jobtimetypeId;
    }

    public void setJobtimetypeId(int jobtimetypeId) {
        this.jobtimetypeId = jobtimetypeId;
    }

    public int getJobtypeId() {
        return jobtypeId;
    }

    public void setJobtypeId(int jobtypeId) {
        this.jobtypeId = jobtypeId;
    }

    public double getLat() {
        return lat;
    }

    public void setLat(double lat) {
        this.lat = lat;
    }

    public double getLon() {
        return lon;
    }

    public void setLon(double lon) {
        this.lon = lon;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getPay() {
        return pay;
    }

    public void setPay(int pay) {
        this.pay = pay;
    }

    public int getPayUnit() {
        return payUnit;
    }

    public void setPayUnit(int payUnit) {
        this.payUnit = payUnit;
    }

    public int getRegiNum() {
        return regiNum;
    }

    public void setRegiNum(int regiNum) {
        this.regiNum = regiNum;
    }
}
